<template>
    <div style="position: relative">
      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        class="table_header_blue"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
      >
        <span slot="tempName" slot-scope="text, record">
          <a style="text-decoration: underline" @click="handleDownloadFile(record.tempUrl)">{{ record.tempName }}</a>
        </span>
        <span slot="jdxwsName" slot-scope="text, record">
          <a style="text-decoration: underline" @click="handleDownloadFile(record.jdxwsUrl)">{{ record.jdxwsName }}</a>
        </span>
        <span slot="actionName">
          <span>操作</span>
        </span>
        <span slot="action" slot-scope="text, record">
          <a-popconfirm
            title="是否确认?"
            :disabled="zbStage === '06010' ? true : record.isqr === 1"
            @confirm="() => handleOK(record)"
          >
            <a-button :disabled="zbStage === '06010' ? true : record.isqr === 1" type="link">{{
              record.isqr === 1 ? '已确认' : '确认'
            }}</a-button>
          </a-popconfirm>
        </span>
      </a-table>
    </div>
</template>
<script>
// 表头
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import columns from './indexColumns'
import { httpAction } from '@/api/manage'

export default {
  props: ['id', 'stage', 'type', 'zbStage'],
  name: 'bcxsjws',
  mixins: [JeecgListMixin],
  components: {},
  data() {
    return {
      queryParam: {
        proId: this.id,
        stage: this.stage,
        typeId: this.type,
      },
      // 表头
      typeId: this.type,
      columns: columns(this),
      url: {
        list: '/sjxmzygl/sjWorkBcxsjws/queryJdxwsList',
      },
    }
  },
  methods: {
    handleOK(record) {
      httpAction('/sjxmzygl/sjWorkBcxsjws/bcxsjwsjdQr', { id: record.id }, 'put').then((res) => {
        if (res.success) {
          this.$message.success(res.message)
          this.loadData()
        } else {
          this.$message.error(res.message)
        }
      })
    },
    modalFormOk() {
      this.loadData()
    },
    handleDownloadFile(fileUrl) {
      this.$message.success('正在下载，请稍等！')
      let url = `${window._CONFIG['domianURL']}/sys/common/download${fileUrl}`
      window.open(url, '_blank')
    },
  },
}
</script>
<style scoped>
</style>
<style lang="less" scoped>
@import '~@assets/less/tableTheme.less';
@import '~@assets/less/common.less';
 .ant-row {
  height: 100%;

  .ant-col {
    height: 100%;

    .ant-card {
      height: 100%;

      /deep/ .ant-card-body {
        padding: 15px;
      }
    }
  }
}
</style>